package com.bruce.tool.push.jpush.entity;

import com.google.common.collect.Maps;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Map;

/**
 * @author Bruce(刘正航)
 */

@NoArgsConstructor(staticName = "create")
public class Callback {
    /**回调数据类型，1：送达回执，2：点击回执，3：送达和点击回执**/
    @Getter
    private int type;
    @Getter
    /**数据临时回调地址，指定后以此处指定为准，仅针对这一次推送请求生效；不指定，则以极光后台配置为准**/
    private String url;
    @Getter
    /**需要回调给用户的自定义参数**/
    private Map<String,Object> params = Maps.newHashMap();

    public Callback type(Integer type){
        this.type = type;
        return this;
    }

    public Callback url(String url){
        this.url = url;
        return this;
    }

    public Callback add(String key,Object value){
        params.put(key,value);
        return this;
    }

    public Callback addAll(Map<String,Object> params){
        this.params = params;
        return this;
    }
}
